import matplotlib.pyplot as plt
import numpy as np
from pylab import *
import pandas as pd
from sklearn.linear_model import LinearRegression

x_parameter=[1,2,3,4,5,6,7,8,9,10]
y_parameter =[14750,17313,18099,18697,24867,25733,27568,28526,28640,28764]

mpl.rcParams['font.sans-serif'] = ['SimHei']
mpl.rcParams['axes.unicode_minus'] = False
x=np.array(x_parameter).reshape(-1,1)
y=np.array(y_parameter)
model = LinearRegression()
model = model.fit(x, y)
score=model.score(x,y)
print(score)
plt.scatter(x, y,color='red')
plt.plot(x,model.predict(x),color='blue')
plt.xlabel("inedx")
plt.ylabel("price（元/m^2）")
plt.show()

